-
Notifications
You must be signed in to change notification settings - Fork 218
feat: enhance OFT token detection to block deposits #2537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…e into feat-enhance-oft-token-detection
…e into feat-enhance-oft-token-detection
) { | ||
const parentProvider = getProviderForChainId(parentChainId) | ||
): Promise<boolean> { | ||
const chainIdToLzName: Record<number, string | undefined> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all values are defined, we can narrow down the type here
// } | ||
// } | ||
|
||
const response = await axios.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we use axios over fetch here? We don't seem to leverage any of the utilities of axios
Issue that triggered this
User was able to transfer ENA token (which is OFT) via Canonical Arbitrum Bridge - which sent it to canonical arbitrum-bridged token counterpart instead of the custom (Arb)ENA token that was deployed via OFT. This prompted us to make our
isLayerZeroToken()
method more robust, which is supposed to block such deposits.In this PR
Description
The previous on-chain OFT detection was unreliable, as it missed tokens like ENA that don't expose the
oftVersion()
method. This caused user funds to be bridged to incorrect, non-OFT contracts on Arbitrum.The new solution uses the LayerZero metadata API as the definitive source for identifying OFT tokens. This ensures accurate detection and prevents improper deposits by marking these tokens as withdraw-only (except USDT0 which is a special case as we have an existing integration for it's transfers).
How to test
Try depositing ENA token (0x57e114b691db790c35207b2e685d4a43181e6061) from Ethereum to Arbitrum One - it should be blocked. Withdrawals should be okay.
Closes FS-1277